import java.util.Arrays;

public class BubbleSort {

    public static int[] bubble (int[] array) {
        for(int i=0;i<array.length;i++) {
            for(int j=0;j<array.length-i-1;j++) {
                if(array[j]>array[j+1]) {
                    int temp=array[j];
                    array[j]=array[j+1];
                    array[j+1]=temp;
                }
            }
        }
        return array;
    }

    public static void main(String[] args) {
        int[] array={2,5,8,1,3,4,6};
        System.out.println(Arrays.toString(bubble(array)));
    }
}
